using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using libsecondlife;

namespace textsl
{
    public partial class LoginForm : Form
    {
        public SecondLife client;

        public LoginForm(SecondLife _client)
        {
            client = _client;

            client.Network.OnConnected += new NetworkManager.ConnectedCallback(Network_OnConnected);

            InitializeComponent();
        }

        void Network_OnConnected(object sender)
        {
            Close();
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void logInButton_Click(object sender, EventArgs e)
        {
            logInButton.Enabled = false;
            if (client.Network.Login(firstNameText.Text,
                lastNameText.Text, passwordText.Text,
                "TextSL", "UNR"))
            {
                Close();
            }
            else
            {
                logInButton.Enabled = true;
            }
        }
    }
}